#include "UiVPlayerDownBar.h"

#ifdef MERGER_APP_TO_SHELL
	extern HINSTANCE g_SDHResModuleHandle;
#endif
UiVPlayerDownBar::UiVPlayerDownBar()
{
}

UiVPlayerDownBar::~UiVPlayerDownBar()
{
}

BOOL UiVPlayerDownBar::InitUiWin(void)
{
	BOOL bRtn = FALSE;
	LoadiInterItem();
	return bRtn;
}

void UiVPlayerDownBar::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
	m_VideoMainBG->Draw(hdc, prcWin, false, false);
}

int UiVPlayerDownBar::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiVPlayerDownBar::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);
	
}

BOOL UiVPlayerDownBar::InitImages()
{

/*
		HDC hDC = GetDC(m_hWnd);
//jdhuang

	RECT rcClient;
	GetClientRect(m_hWnd, &rcClient);

	m_hBakDC = CreateCompatibleDC(hDC);

	m_hBitmapBakDC = CreateCompatibleBitmap(hDC, RECT_WIDTH(rcClient), RECT_HEIGHT(rcClient));
	SelectObject(m_hBakDC, m_hBitmapBakDC);

	//jdhuang 20090616
//	HDC hMemDc = CreateCompatibleDC(m_hBakDC);

	if(m_VideoMainBG)
	{
		m_VideoMainBG->Draw(m_hBakDC, &rcClient, false, false);
		DeleteDC(hMemDc);
	}
	ReleaseDC(m_hWnd, hDC);
*/
	return TRUE;
}

void UiVPlayerDownBar::LoadiInterItem()
{
//jdhuang 20120818
#ifndef MERGER_APP_TO_SHELL
	m_VideoMainBG = ImagingHelper::GetImageObject(MzGetInstanceHandle(), 1041);
#else
	m_VideoMainBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 7041);
#endif
	RECT rtBtnPrev = {12, 2, 88, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_PREV].SetPos(rtBtnPrev.left, rtBtnPrev.top, rtBtnPrev.right-rtBtnPrev.left, rtBtnPrev.bottom-rtBtnPrev.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_PREV].SetID(3200);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_PREV].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1010, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_PREV].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1011, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_PREV].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7010, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_PREV].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7011, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_PREV]);

	RECT rtBtnPlay = {112, 2, 188, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_PLAY].SetPos(rtBtnPlay.left, rtBtnPlay.top, rtBtnPlay.right-rtBtnPlay.left, rtBtnPlay.bottom-rtBtnPlay.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_PLAY].SetID(3201);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_PLAY].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1002, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_PLAY].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1003, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_PLAY].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7002, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_PLAY].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7003, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_PLAY]);

	RECT rtBtnNext = {212, 2, 288, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_NEXT].SetPos(rtBtnNext.left, rtBtnNext.top, rtBtnNext.right-rtBtnNext.left, rtBtnNext.bottom-rtBtnNext.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_NEXT].SetID(3202);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_NEXT].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1012, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_NEXT].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1013, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_NEXT].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7012, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_NEXT].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7013, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_NEXT]);

	RECT rtBtnStop = {312, 2, 388, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_STOP].SetPos(rtBtnStop.left, rtBtnStop.top, rtBtnStop.right-rtBtnStop.left, rtBtnStop.bottom-rtBtnStop.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_STOP].SetID(3203);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_STOP].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1018, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_STOP].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1019, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_STOP].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7018, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_STOP].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7019, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_STOP]);

	RECT rtBtnDiscDes = {412, 2, 488, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES].SetPos(rtBtnDiscDes.left, rtBtnDiscDes.top, rtBtnDiscDes.right-rtBtnDiscDes.left, rtBtnDiscDes.bottom-rtBtnDiscDes.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES].SetID(3204);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1027, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1028, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7027, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7028, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_DISC_DES]);

	RECT rtBtnDiscAdd = {512, 2, 588, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD].SetPos(rtBtnDiscAdd.left, rtBtnDiscAdd.top, rtBtnDiscAdd.right-rtBtnDiscAdd.left, rtBtnDiscAdd.bottom-rtBtnDiscAdd.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD].SetID(3205);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1029, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1030, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7029, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7030, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_DISC_ADD]);

	RECT rtBtnCircle = {612, 2, 688, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE].SetPos(rtBtnCircle.left, rtBtnCircle.top, rtBtnCircle.right-rtBtnCircle.left, rtBtnCircle.bottom-rtBtnCircle.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE].SetID(3206);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1025, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1026, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7025, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7026, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_CIRCLE]);

	RECT rtBtnBrowser = {712, 2, 788, 78};
	m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER].SetPos(rtBtnBrowser.left, rtBtnBrowser.top, rtBtnBrowser.right-rtBtnBrowser.left, rtBtnBrowser.bottom-rtBtnBrowser.top);
	m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER].SetID(3207);
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1008, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1009, true));
#else
	m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7008, true));
	m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,7009, true));
#endif
	AddChild(&m_BtnDownBar[VPLAYER_DOWNBAR_BROWSER]);

}
void UiVPlayerDownBar::DeleteImages()
{
}